package com.example.java_chatroom.demo;

// 泛型方法
public class Demo02 {
    public static <E> void swap(E[] array, int i, int j) {
        E t = array[i];
        array[i] = array[j];
        array[j] = t;
    }

    public static void main(String[] args) {
        Integer[] a = {1,2,3,4,5,6};
        swap(a, 1,2);
        for(int i=0;i<a.length;i++) {
            System.out.print(a[i]+" ");
        }

    }
}
